export default {
  data() {
    let contactsvalidator = (rule, value, callback) => {
      if (!this.regCheck('empty', value)) {
        callback(new Error('请输入联系人'))
      } else {
        callback()
      }
    }
    let contactNumber = (rule, value, callback) => {
      if (!this.regCheck('empty', value)) {
        callback(new Error('请输入验证码'))
      } else {
        callback()
      }
    }
    let phoneNumberlidator = (rule, value, callback) => {
      if (!this.regCheck('empty', value)) {
        callback(new Error('请输入联系方式'))
      } else if(this.regCheck('fmPhone', value)) {
        callback(new Error('请输入正确的联系方式'))
      } else {
        callback()
      }
    }
    return {
      rules: {
        contacts: [{ validator: contactsvalidator, trigger: 'blur' }],
        phoneNumber: [{ validator: phoneNumberlidator, trigger: 'blur' }]
        // contactNumber: [{ validator: contactNumber, trigger: 'blur' }],
      },
      ruleForm: {
        contacts: '', // 联系人
        phoneNumber: '', // 联系电话
        contactNumber: '' // 验证码
      }
    }
  }
}
